package com.example.zxw.entity;

import android.text.TextUtils;

import androidx.annotation.Nullable;

import com.chad.library.adapter.base.entity.MultiItemEntity;
import java.io.Serializable;
import java.util.ArrayList;
import java.util.List;

/**
 * 新闻列表list实体类
 *
 * @author HXL
 */
public class NewsListEntity implements Serializable, MultiItemEntity {
    /**
     * 直播视频封面图
     */
    private String livePic = "";
    /**
     * 直播开始时间
     */
    private String liveDate = "";
    /**
     * 直播视频地址
     */
    private String liveAddr = "";
    /**
     * 直播状态
     */
    private String liveStatus = "";

    private String appPic3 = "";
    private String classify = "";
    private String appPic2 = "";
    private String appPic1 = "";
    //新闻来源
    private String source = "";
    // 显示title
    private String title = "";
    //阅读量
    private String readCount = "";
    // 图片地址
    private String picture = "";
    //发布时间
    private String pubtime = "";
    //显示样式
    private String showType = "";
    private String topicName = "";
    //新闻所属频道的标识图片URL
    private String titleStyle = "";
    private String titleLogo;
    // id
    private String id = "";
    //专题链接
    private String isLink = "";
    //分类为直播时，直播的ID
    private String isLive = "";
    //图片个数
    private String picCount = "";
    //控制是否显示swiperbar类型文件标题
    private String isShowTitle = "";
    //动态设置图片宽高的比率
    private String ratio = "";
    //用来说明轮播条里每条新闻的类型
    private String swiperType = "";
    //多连发专题标题
    private String dlfTitle = "";
    //手动输入的多连发角标
    private String dlfLogoTxt = "";
    //多连发角标
    private String dlfLogo = "";
    private String hmName = "";
    private String content = "";
    //8.5.8新增mp3文件
    private String audioUrl = "";
    //轮播图悬浮logo和文字
    private String dlfTitleLogo = "";
    private String dlfTitleLogoTxt = "";
    private String dlfTitleImg = "";
    private String dlfTitleImgRatio = "";
    private String dlfShowTitle = "";

    private String shareUrl = "";

    private String searchTxt;

    private String contentForDetail;

    private String topicId;

    /**
     * 站点多连发才有，是否显示简介,yse/no
     */
    private String dlfShowSummary;

    /**
     * 站点多连发，是否显示更多
     */
    private String dlfShowMore;

    private String exid;

    private String expicture;

    private String cmtp;

    private String cmid;

    private String top;


    /**
     * 6606版本增加事件进展字段,事件id和事件信息
     */
    private String eventId = "";
    private String eventInfo = "";
    private String tagType = "";

    private int dlfItemCount;//多连发item数量

    private String channelName;

    private String isEcns;

    private String description;

    public String getDescription() {
        return description;
    }

    public void setDescription(String description) {
        this.description = description;
    }

    public String getChannelName() {
        return channelName;
    }

    public void setChannelName(String channelName) {
        this.channelName = channelName;
    }

    public boolean isEcns() {
        return "yes".equalsIgnoreCase(isEcns);
    }

    public void setEcns(String ecns) {
        isEcns = ecns;
    }

    public int getDlfItemCount() {
        return dlfItemCount;
    }

    public void setDlfItemCount(int dlfItemCount) {
        this.dlfItemCount = dlfItemCount;
    }

    private List<NewsSubChannelEntity> subChannelEntityList;

    public List<NewsSubChannelEntity> getSubChannelEntityList() {
        return subChannelEntityList;
    }

    public void setSubChannelEntityList(List<NewsSubChannelEntity> subChannelEntityList) {
        this.subChannelEntityList = subChannelEntityList;
    }

    public String getEventId() {
        return eventId;
    }

    public String getTagType() {
        return tagType;
    }

    //步本統計的字段
    private String alg_group = "";
    private String scene = "";
    //674版本加的通栏图 dlfRatio图片比例  showDlfNewsTitle标题是否显示
    private String dlfRatio = "";
    private String showDlfNewsTitle = "";

    public String getDlfRatio() {
        return dlfRatio;
    }

    public String getShowDlfNewsTitle() {
        return showDlfNewsTitle;
    }

    private String videoDuration = "";

    public String getVideoDuration() {
        return videoDuration;
    }

    //6.7.4新增横向多连发背景图
    private String dlfBgImg;

    public String getAlg_group() {
        return alg_group;
    }

    public String getScene() {
        return scene;
    }

    private String date;//热点直播的时间
    private String status;//热点直播的视频状态
    //热词搜索的数据
    private List<HotWordsEntity> mHotWordList;

    //6.7.7置顶稿件隐藏分割线
    private String order = "1";
    private String channelOrder = "1";
    private String isShowMore;
    // 6.7.7热点轮播图添加左侧自定义角标
    private String titleLogos;

    /**
     * 679多连发跳转的字段修改下面字段
     */
    private String dlfLinkType;
    private String dlfLinkChannel;
    private String dlfLinkSearch;
    private String dlfLinkTopic;
    private String dlfLinkHotNewsTopic;
    /**
     * 横向多连发子条目，无图时用此字段显示摘要
     */
    private String summary;

    private String dlfType;
    /**
     * 正文海报分享图片首选字段
     */
    private String appImgSearch;
    //多连发条目
    private List<NewsListEntity> dlfList;
    //视频地址
    private String video;
    //最后更新时间
    private String freshTime;
    private List<NewsListEntity> dlfHorizontalList = new ArrayList<>();

    /**
     * 679因后台将站点多连发与其他多连发使用的同一个dlfList字段，所有将站点多连发的字段合并到此
     */
    private String name;
    private String fname;
    private String cname;
    private String type;
    private String isV;

    //中新号相关字段
    private String cnsMediaUnique;
    private String cnsMediaVColor;
    private String cnsMediaSummary;
    private String cnsMediaFsummary;
    private String cnsMediaName;
    private String cnsMediaFname;
    private String cnsMediaCode;
    private String cnsMediaType;
    private String cnsMediaLogo;
    private boolean showCardStyle;
    public boolean showConcernBtn = true;//是否展示关注按钮

    //7.1.1 视频方向字段，横向还是竖向
    private String isVerticallyVideo;//横:heng 竖：shu

    //7.2.0 广告接口拆分后 广告位置
    private String listPosition;//频道位置
    private String homePosition;//首页位置(要闻页）


    public int getListPosition() {
        return Integer.parseInt(listPosition);
    }

    public int getHomePosition() {
        return Integer.parseInt(homePosition);
    }

    public void setListPosition(String listPosition) {
        this.listPosition = listPosition;
    }

    public void setHomePosition(String homePosition) {
        this.homePosition = homePosition;
    }

    public String getIsVerticallyVideo() {
        return isVerticallyVideo;
    }

    public void setIsVerticallyVideo(String isVerticallyVideo) {
        this.isVerticallyVideo = isVerticallyVideo;
    }

    public boolean isShowCardStyle() {
        return showCardStyle;
    }

    public void setShowCardStyle(boolean showCardStyle) {
        this.showCardStyle = showCardStyle;
    }

    public String getCnsMediaCode() {
        return cnsMediaCode;
    }

    public void setCnsMediaCode(String cnsMediaCode) {
        this.cnsMediaCode = cnsMediaCode;
    }

    public String getCnsMediaType() {
        return cnsMediaType;
    }

    public void setCnsMediaType(String cnsMediaType) {
        this.cnsMediaType = cnsMediaType;
    }

    public String getCnsMediaLogo() {
        return cnsMediaLogo;
    }

    public void setCnsMediaLogo(String cnsMediaLogo) {
        this.cnsMediaLogo = cnsMediaLogo;
    }

    public String getCnsMediaUnique() {
        return cnsMediaUnique;
    }

    public void setCnsMediaUnique(String cnsMediaUnique) {
        this.cnsMediaUnique = cnsMediaUnique;
    }

    public String getCnsMediaVColor() {
        return cnsMediaVColor;
    }

    public void setCnsMediaVColor(String cnsMediaVColor) {
        this.cnsMediaVColor = cnsMediaVColor;
    }

    public String getCnsMediaSummary() {
        return cnsMediaSummary;
    }

    public void setCnsMediaSummary(String cnsMediaSummary) {
        this.cnsMediaSummary = cnsMediaSummary;
    }

    public String getCnsMediaName() {
        return cnsMediaName;
    }

    public void setCnsMediaName(String cnsMediaName) {
        this.cnsMediaName = cnsMediaName;
    }


    private double dlfTopPicRatio;

    public String getName() {
        return name;
    }

    public String getFname() {
        return fname;
    }

    public String getCname() {
        return cname;
    }

    public void setCname(String cname) {
        this.cname = cname;
    }


    public String getType() {
        return type;
    }

    public String getIsV() {
        return isV;
    }

    public void setDlfLinkType(String dlfLinkType) {
        this.dlfLinkType = dlfLinkType;
    }

    public void setDlfLinkChannel(String dlfLinkChannel) {
        this.dlfLinkChannel = dlfLinkChannel;
    }

    public void setDlfLinkSearch(String dlfLinkSearch) {
        this.dlfLinkSearch = dlfLinkSearch;
    }

    public void setDlfLinkTopic(String dlfLinkTopic) {
        this.dlfLinkTopic = dlfLinkTopic;
    }

    public void setDlfLinkHotNewsTopic(String dlfLinkHotNewsTopic) {
        this.dlfLinkHotNewsTopic = dlfLinkHotNewsTopic;
    }

    public String getDlfLinkType() {
        return dlfLinkType;
    }

    public String getDlfLinkChannel() {
        return dlfLinkChannel;
    }

    public String getDlfLinkSearch() {
        return dlfLinkSearch;
    }

    public String getDlfLinkTopic() {
        return dlfLinkTopic;
    }

    public String getDlfLinkHotNewsTopic() {
        return dlfLinkHotNewsTopic;
    }

    public String getTitleLogos() {
        return titleLogos;
    }

    public void setTitleLogos(String titleLogos) {
        this.titleLogos = titleLogos;
    }

    public String getIsShowMore() {
        return isShowMore;
    }

    public String getOrder() {
        return order;
    }

    public String getChannelOrder() {
        return channelOrder;
    }

    public List<HotWordsEntity> getHotWordList() {
        return mHotWordList;
    }

    public void setHotWordList(List<HotWordsEntity> mHotWordList) {
        this.mHotWordList = mHotWordList;
    }

    public String getDlfTitleImg() {
        return dlfTitleImg;
    }

    public void setDlfTitleImg(String dlfTitleImg) {
        this.dlfTitleImg = dlfTitleImg;
    }

    public String getDlfTitleImgRatio() {
        return dlfTitleImgRatio;
    }

    public void setDlfTitleImgRatio(String dlfTitleImgRatio) {
        this.dlfTitleImgRatio = dlfTitleImgRatio;
    }

    public String getDlfShowTitle() {
        return dlfShowTitle;
    }

    public void setDlfShowTitle(String dlfShowTitle) {
        this.dlfShowTitle = dlfShowTitle;
    }

    public String getDlfLogoTxt() {
        return dlfLogoTxt;
    }

    public void setDlfLogoTxt(String dlfLogoTxt) {
        this.dlfLogoTxt = dlfLogoTxt;
    }

    public String getEventInfo() {
        return eventInfo;
    }

    public String getDlfTitleLogo() {
        return dlfTitleLogo;
    }

    public void setDlfTitleLogo(String dlfTitleLogo) {
        this.dlfTitleLogo = dlfTitleLogo;
    }

    public String getDlfTitleLogoTxt() {
        return dlfTitleLogoTxt;
    }

    public void setDlfTitleLogoTxt(String dlfTitleLogoTxt) {
        this.dlfTitleLogoTxt = dlfTitleLogoTxt;
    }

    public String getHmName() {
        return hmName;
    }

    public void setHmName(String hmName) {
        this.hmName = hmName;
    }

    public String getIsShowTitle() {
        return isShowTitle;
    }

    public void setIsShowTitle(String isShowTitle) {
        this.isShowTitle = isShowTitle;
    }

    public String getRatio() {
        return ratio;
    }

    public void setRatio(String ratio) {
        this.ratio = ratio;
    }

    public String getSwiperType() {
        return swiperType;
    }

    public void setSwiperType(String swiperType) {
        this.swiperType = swiperType;
    }

    public List<NewsListEntity> getDlfList() {
        return dlfList;
    }

    public void setDlfList(List<NewsListEntity> dlfList) {
        this.dlfList = dlfList;
    }

    @Nullable
    public String getDate() {
        return date;
    }

    public void setDate(String date) {
        this.date = date;
    }

    @Nullable
    public String getStatus() {
        return status;
    }

    public void setStatus(String status) {
        this.status = status;
    }

    public String getFreshTime() {
        return freshTime;
    }

    public void setFreshTime(String freshTime) {
        this.freshTime = freshTime;
    }


    public String getPicCount() {
        return picCount;
    }

    public void setPicCount(String picCount) {
        this.picCount = picCount;
    }

    public String getIsLive() {
        return isLive;
    }

    public String getVideo() {
        return video;
    }

    public void setVideo(String video) {
        this.video = video;
    }

    public void setIsLive(String isLive) {
        this.isLive = isLive;
    }

    public String getIsLink() {
        return isLink;
    }

    public void setIsLink(String isLiinked) {
        this.isLink = isLiinked;
    }

    private ArrayList<String> cimgslist;

    public String getPicture() {
        return picture;
    }

    public ArrayList<String> getCimgslist() {
        return cimgslist;
    }

    public void setCimgslist(ArrayList<String> cimgslist) {
        this.cimgslist = cimgslist;
    }

    public void setPicture(String picture) {
        this.picture = picture;
    }

    public String getAppPic3() {
        return appPic3;
    }

    public void setAppPic3(String appPic3) {
        this.appPic3 = appPic3;
    }

    public String getClassify() {
        return classify;
    }

    public void setClassify(String classify) {
        this.classify = classify;
    }

    public String getAppPic2() {
        return appPic2;
    }

    public void setAppPic2(String appPic2) {
        this.appPic2 = appPic2;
    }

    public String getAppPic1() {
        return appPic1;
    }

    public void setAppPic1(String appPic1) {
        this.appPic1 = appPic1;
    }

    public String getSource() {
        return source;
    }

    public void setSource(String source) {
        this.source = source;
    }

    public String getTitle() {
        return title;
    }

    public void setTitle(String title) {
        this.title = title;
    }

    public String getReadCount() {
        return readCount;
    }

    public void setReadCount(String readCount) {
        this.readCount = readCount;
    }


    public String getPubtime() {
        return pubtime;
    }

    public void setPubtime(String pubtime) {
        this.pubtime = pubtime;
    }

    public String getShowType() {
        return showType;
    }

    public void setShowType(String showType) {
        this.showType = showType;
    }

    public String getTopicName() {
        return topicName;
    }

    public void setTopicName(String topicName) {
        this.topicName = topicName;
    }

    public String getTitleStyle() {
        return titleStyle;
    }

    public void setTitleStyle(String titleStyle) {
        this.titleStyle = titleStyle;
    }

    public String getTitleLogo() {
        return titleLogo;
    }

    public void setTitleLogo(String titleLogo) {
        this.titleLogo = titleLogo;
    }

    public String getId() {
        return id;
    }

    public void setId(String id) {
        this.id = id;
    }

    @Override
    public String toString() {
        return "NewsListEntity{" +
                "appPic3='" + appPic3 + '\'' +
                ", classify='" + classify + '\'' +
                ", appPic2='" + appPic2 + '\'' +
                ", appPic1='" + appPic1 + '\'' +
                ", source='" + source + '\'' +
                ", title='" + title + '\'' +
                ", readCount='" + readCount + '\'' +
                ", picture=" + picture +
                ", pubtime='" + pubtime + '\'' +
                ", showType='" + showType + '\'' +
                ", topicName='" + topicName + '\'' +
                ", titleStyle='" + titleStyle + '\'' +
                ", id='" + id + '\'';
    }

    @Override
    public int hashCode() {
        final int prime = 31;
        int result = 1;
        result = prime * result + ((id == null) ? 0 : id.hashCode());
        result = prime * result + ((title == null) ? 0 : title.hashCode());
        return result;
    }

    @Override
    public boolean equals(Object obj) {
        if (this == obj) {
            return true;
        }
        if (obj == null) {
            return false;
        }
        if (getClass() != obj.getClass()) {
            return false;
        }
        NewsListEntity other = (NewsListEntity) obj;
        if (id == null) {
            if (other.id != null) {
                return false;
            }
        } else if (!id.equals(other.id)) {
            return false;
        }
        if (title == null) {
            return other.title == null;
        } else return title.equals(other.title);
    }






    /**
     * 是否是关注卡片样式
     * 要求后期需要支持在任何频道出现
     * @return
     */
    private boolean isFollowCardStyle(){
        return !TextUtils.isEmpty(cnsMediaUnique)&&isShowCardStyle();
    }

    public String getDlfTitle() {
        return dlfTitle;
    }

    public void setDlfTitle(String dlfTitle) {
        this.dlfTitle = dlfTitle;
    }

    public String getDlfLogo() {
        return dlfLogo;
    }

    public void setDlfLogo(String dlfLogo) {
        this.dlfLogo = dlfLogo;
    }

    public String getDlfType() {
        return dlfType;
    }

    public void setDlfType(String dlfType) {
        this.dlfType = dlfType;
    }

    public List<NewsListEntity> getDlfHorizontalList() {
        return dlfHorizontalList;
    }

    public void setDlfHorizontalList(List<NewsListEntity> dlfHorizontalList) {
        this.dlfHorizontalList = dlfHorizontalList;
    }

    public String getContent() {
        return content;
    }

    public void setContent(String content) {
        this.content = content;
    }

    public String getAudioUrl() {
        return audioUrl;
    }

    public void setAudioUrl(String audioUrl) {
        this.audioUrl = audioUrl;
    }

    public String getSearchTxt() {
        return searchTxt;
    }

    public void setSearchTxt(String searchTxt) {
        this.searchTxt = searchTxt;
    }

    public String getDlfShowSummary() {
        return dlfShowSummary;
    }

    public void setDlfShowSummary(String dlfShowSummary) {
        this.dlfShowSummary = dlfShowSummary;
    }

    public String getDlfShowMore() {
        return dlfShowMore;
    }

    public void setDlfShowMore(String dlfShowMore) {
        this.dlfShowMore = dlfShowMore;
    }

    public String getSummary() {
        return summary;
    }

    public void setSummary(String summary) {
        this.summary = summary;
    }

    public String getShareUrl() {
        return shareUrl;
    }

    public void setShareUrl(String shareUrl) {
        this.shareUrl = shareUrl;
    }

    public String getContentForDetail() {
        return contentForDetail;
    }

    public void setContentForDetail(String contentForDetail) {
        this.contentForDetail = contentForDetail;
    }

    public String getTopicId() {
        return topicId;
    }

    public void setTopicId(String topicId) {
        this.topicId = topicId;
    }

    public String getExid() {
        return exid;
    }

    public void setExid(String exid) {
        this.exid = exid;
    }

    public String getExpicture() {
        return expicture;
    }

    public void setExpicture(String expicture) {
        this.expicture = expicture;
    }

    public String getCmtp() {
        return cmtp;
    }

    public void setCmtp(String cmtp) {
        this.cmtp = cmtp;
    }

    public String getCmid() {
        return cmid;
    }

    public void setCmid(String cmid) {
        this.cmid = cmid;
    }

    public String getTop() {
        return top;
    }

    public void setTop(String top) {
        this.top = top;
    }

    public String getAppImgSearch() {
        return appImgSearch;
    }

    public void setAppImgSearch(String appImgSearch) {
        this.appImgSearch = appImgSearch;
    }

    public String getLivePic() {
        return livePic;
    }

    public void setLivePic(String livePic) {
        this.livePic = livePic;
    }

    public String getLiveDate() {
        return liveDate;
    }

    public void setLiveDate(String liveDate) {
        this.liveDate = liveDate;
    }

    public String getLiveAddr() {
        return liveAddr;
    }

    public void setLiveAddr(String liveAddr) {
        this.liveAddr = liveAddr;
    }

    public String getLiveStatus() {
        return liveStatus;
    }

    public void setLiveStatus(String liveStatus) {
        this.liveStatus = liveStatus;
    }

    public String getDlfBgImg() {
        return dlfBgImg;
    }

    public void setDlfBgImg(String dlfBgImg) {
        this.dlfBgImg = dlfBgImg;
    }

    public double getDlfTopPicRatio() {
        return dlfTopPicRatio;
    }

    public void setDlfTopPicRatio(double dlfTopPicRatio) {
        this.dlfTopPicRatio = dlfTopPicRatio;
    }


    /**
     *  if ("-1".equals(showType)) {
     *                 return getTextType();
     *             } else if ("m0".equals(showType)) {
     *                 return getRightImageType();
     *             } else if ("m1".equals(showType)) {
     *                 if(isFollowCardStyle()){
     *                     return NewsListAdapter.TYPE_LARGE_IMAGE_FOLLOW_CARD_STYLE;
     *                 }
     *                 return NewsListAdapter.TYPE_LARGE_IMAGE;
     *             } else if ("m2".equals(showType)) {
     *                 return getTwoImgType();
     *             } else if ("m3".equals(showType)) {
     *                 return getThreeImgType();
     *             } else if ("m4".equals(showType)) {
     *                 return NewsListAdapter.TYPE_LARGE_PIC_5_2;
     *             } else if ("m5".equals(showType)) {
     *                 return NewsListAdapter.TYPE_LARGE_PIC_16_5;
     *             } else if ("m13".equals(showType)) {
     *                 return getDxwCustomBigImageType();
     *             } else if ("m14".equals(showType)) {
     *                 return getQuestionType();
     *             }
     * @return
     */
    @Override
    public int getItemType() {
        if(NewsClassify.ZW.getClassify().equals(classify)){
            switch (showType){
                case "-1":return NewsType.TYPE_TEXT.getType();
                case "m0":return NewsType.TYPE_RIGHT_IMAGE.getType();
                case "m1":return NewsType.TYPE_LARGE_IMAGE.getType();
                case "m2":return NewsType.TYPE_TWO_IMAGES.getType();
                case "m3":return NewsType.TYPE_THREE_IMAGE.getType();
            }
        }
        return NewsType.TYPE_TEXT.getType();
    }
}
